// +---------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +---------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +---------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +---------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +---------------------------------------------------------------------

import request from '@/libs/request';

/**
 * @description 获取经销商列表
 * @param {Object} param params {Object} 传值参数
 */
export function getDealerList(params) {
  return request({
    url: '/seed/dealerList',
    method: 'get',
    params,
  });
}

/**
 * @description 添加经销商
 * @param {Object} data {Object} 传值参数
 * company: 公司名称
 * company_short: 公司简称
 * user_name: 联系人
 * user_phone: 联系电话
 * area_name: 地区
 * province: 省份ID
 * city: 城市ID
 * area: 区域ID
 */
export function addDealer(data) {
  return request({
    url: '/seed/addDealer',
    method: 'post',
    data,
  });
}

/**
 * @description 修改经销商
 * @param {Object} data {Object} 传值参数
 */
export function updateDealer(data) {
  return request({
    url: '/seed/updateDealer',
    method: 'post',
    data,
  });
}

/**
 * @description 编辑经销商
 * @param {Object} data {Object} 传值参数
 * id: 经销商ID
 * company: 公司名称
 * company_short: 公司简称
 * user_name: 联系人
 * user_phone: 联系电话
 * area_name: 地区
 * province: 省份ID
 * city: 城市ID
 * area: 区域ID
 */
export function editDealer(data) {
  return request({
    url: '/seed/editDealer',
    method: 'post',
    data,
  });
}

/**
 * @description 获取经销商详情
 * @param {Number} id {Number} 经销商id
 */
export function getDealerDetail(id) {
  return request({
    url: `/seed/dealerDetail/${id}`,
    method: 'get',
  });
}

/**
 * @description 修改经销商状态
 * @param {Number} id {Number} 经销商id
 * @param {Number} status {Number} 状态
 */
export function changeDealerStatus(id, status) {
  return request({
    url: `/seed/dealerStatus/${id}`,
    method: 'post',
    data: { status },
  });
}

/**
 * @description 删除经销商
 * @param {Number} id {Number} 经销商id
 */
export function deleteDealer(id) {
  return request({
    url: `/seed/delDealer/${id}`,
    method: 'delete',
  });
}
